T-REEX algorithm